package multiThreading.Account;

public class save extends Thread {
    private account a;
    private double money;

    public save(account a, double money) {
        this.a = a;
        this.money = money;
    }
    @Override
    public void run() {
        try {
            sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i <10; i++) {//重复10次那种取钱的行为
            this.a.saveMoney(this.money);
        }
    }
}

class get extends Thread {
    private account a;
    private double money;

    public get(account a, double money) {
        this.a = a;
        this.money = money;
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            this.a.getMoney(this.money);
        }
    }
}
